package com.ht.medicaltreatment.utils

import com.blankj.utilcode.util.TimeUtils
import java.util.Calendar

object WeekDayUtils {
    fun getWeekDayList(list:(List<Long>) -> Unit){
        // 存放每一天时间的集合
        val weekMillisList: MutableList<Long> = ArrayList()
        var dateMill = TimeUtils.getNowMills()
        // Calendar
        val calendar = Calendar.getInstance()
        calendar.timeInMillis = dateMill
        // 本周的第几天
        val weekNumber = calendar[Calendar.DAY_OF_WEEK]
        // 获取本周一的毫秒值   86400000是一天的毫秒值
        val mondayMill: Long = dateMill - 86400000 * (weekNumber - 2)
        for (i in 0..6) {
            weekMillisList.add(mondayMill + 86400000 * i)
        }
        list(weekMillisList)
    }
}